package streamAndFile;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


public class InputStreamReaderTest {
	//201521123081
	public static void main(String[] args) throws IOException{	
		Scanner in = new Scanner(new FileReader("e:\\EncodeTest.txt"));
		String line = null;
		while(in.hasNext()){
			line = in.nextLine();
			System.out.println(line);
		}
		in.close();
		
		BufferedReader br = null;
		try {
			
			//201521123081
			FileInputStream fis = new FileInputStream("e:\\EncodeTest.txt");
			InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
			br = new BufferedReader(isr);
			br = new BufferedReader(new FileReader(new File("e:\\EncodeTest.txt")));
			while((line=br.readLine())!=null){
				System.out.println(line);
			};
		} catch(FileNotFoundException e){
			e.printStackTrace();
		} catch(IOException e){
			e.printStackTrace();
		}finally{
				br.close();
		}
	}
	

}


